let deps = [];

function useEffect(callback, dependencies) {
  // hasChanged 表示依赖项是否有变化
  const hasChanged = dependencies.some((dep, index) => dep !== deps[index]);

  if (!deps.length || hasChanged) {
    callback();
    deps = [...dependencies];
  }
}

useEffect(() => {
  console.log('count:', count);
}, [count]);